#!/bin/sh

RECALBOX_ROOT=$(realpath $(dirname $(readlink -f "$0"))/../..)
CHECK_PACKAGE_BIN=${RECALBOX_ROOT}/buildroot/utils/check-package

if ! [ -x ${CHECK_PACKAGE_BIN} ]; then
  echo "ERROR: Buildroot submodule has probably not been checked out yet. Please do it with:"
  echo "  $ git submodule init"
  exit 1
fi

${CHECK_PACKAGE_BIN} \
  ${RECALBOX_ROOT}/package/**/*.hash ${RECALBOX_ROOT}/custom/package/**/*.hash \
  ${RECALBOX_ROOT}/package/**/*.mk ${RECALBOX_ROOT}/custom/package/**/*.mk \
  ${RECALBOX_ROOT}/package/**/Config.in ${RECALBOX_ROOT}/custom/package/**/Config.in
